package com.zhf.rabbitmq.pubsub;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Connection;
import com.zhf.rabbitmq.utils.RabbitConstant;
import com.zhf.rabbitmq.utils.RabbitUtil;

import java.util.Scanner;

/**
 * @author: 曾鸿发
 * @create: 2022-01-08 21:27
 * @description：
 **/
public class WeatherForcast {

    public static void main(String[] args) throws Exception{
        Connection connection = RabbitUtil.getConnection();
        String input = new Scanner(System.in).next();
        Channel channel = connection.createChannel();
        // 1.交换机名字
        channel.basicPublish(RabbitConstant.EXCHANGE_WEATHER, "", null, input.getBytes());
        channel.close();
        connection.close();
    }
}
